package cn.benben.core.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Entity基类
 *
 * @author xn
 */
@Data
public class BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    public static final String FIELD_ID = "id";

    public static final String CREATE_ID  = "createId";
    public static final String CREATE_ID_COLUMN  = "create_id";

    public static final String CREATE_TIME = "createTime";
    public static final String CREATE_TIME_COLUMN = "create_time";

    public static final String CREATE_BY = "createBy";
    public static final String CREATE_BY_COLUMN = "create_by";


    public static final String UPDATE_ID = "updateId";
    public static final String UPDATE_ID_COLUMN = "update_id";

    public static final String UPDATE_TIME = "updateTime";
    public static final String UPDATE_TIME_COLUMN = "update_time";

    public static final String UPDATE_BY = "updateBy";
    public static final String UPDATE_BY_COLUMN = "update_by";




    /**
     * 搜索值
     */
    @TableField(exist = false)
    private String searchValue;

    /**
     * 创建者
     */
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    /**
     * 创建者id
     */
    @TableField(fill = FieldFill.INSERT)
    private Long createId;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新者
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    /**
     * 更新者id
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateId;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 备注
     */
    private String remark;

    /**
     * 删除 0未删除，1删除
     */
    @TableLogic
    private String delFlag;

    /**
     * 请求参数
     */
    @TableField(exist = false)
    private Map<String, Object> params = new HashMap<>();

}
